﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
using SharpSqlAnalyzer.pp.para;
using SharpSqlAnalyzer.pp.para.styleenums;
using SharpSqlAnalyzer.pp.processor.type.alter;
using SharpSqlAnalyzer.pp.processor.type.comm;
using SharpSqlAnalyzer.pp.processor.type.createtable;
using SharpSqlAnalyzer.pp.processor.type.createview;
using SharpSqlAnalyzer.pp.processor.type.declare;
using SharpSqlAnalyzer.pp.processor.type.delete;
using SharpSqlAnalyzer.pp.processor.type.execute;
using SharpSqlAnalyzer.pp.processor.type.ifstmt;
using SharpSqlAnalyzer.pp.processor.type.insert;
using SharpSqlAnalyzer.pp.processor.type.merge;
using SharpSqlAnalyzer.pp.processor.type.plsql;
using SharpSqlAnalyzer.pp.processor.type.rtn;
using SharpSqlAnalyzer.pp.processor.type.select;
using SharpSqlAnalyzer.pp.processor.type.update;

namespace SharpSqlAnalyzer.pp.processor
{
	// Token: 0x0200022C RID: 556
	public class ProcessorFactory
	{
		// Token: 0x06001293 RID: 4755 RVA: 0x003198C1 File Offset: 0x00317AC1
		public static ColumnlistCommaProcessor createColumnlistCommaProcessor(GFmtOpt option, TLinefeedsCommaOption commaOption, TAlignStyle option2)
		{
			return ProcessorFactory.create<ColumnlistCommaProcessor>(typeof(ColumnlistCommaProcessor), option, new object[]
			{
				commaOption,
				option2
			});
		}

		// Token: 0x06001294 RID: 4756 RVA: 0x003198EB File Offset: 0x00317AEB
		public static AlignAliasProcessor createAlignAliasProcessor(GFmtOpt option, bool option2, TAlignStyle style)
		{
			return ProcessorFactory.create<AlignAliasProcessor>(typeof(AlignAliasProcessor), option, new object[]
			{
				option2,
				style
			});
		}

		// Token: 0x06001295 RID: 4757 RVA: 0x00319915 File Offset: 0x00317B15
		public static AppendNewLineAfterReverseKeyWordProcessor appendNewLineAfterReverseKeyWordProcessor(GFmtOpt option, bool isItemInNewLine, string keyword)
		{
			return ProcessorFactory.create<AppendNewLineAfterReverseKeyWordProcessor>(typeof(AppendNewLineAfterReverseKeyWordProcessor), option, new object[]
			{
				isItemInNewLine,
				keyword
			});
		}

		// Token: 0x06001296 RID: 4758 RVA: 0x0031993A File Offset: 0x00317B3A
		public static DistinctKeyWordProcessor createDistinctKeyWordProcessor(GFmtOpt option, bool isTreatDistinctAsVirtualColumn)
		{
			return ProcessorFactory.create<DistinctKeyWordProcessor>(typeof(DistinctKeyWordProcessor), option, new object[]
			{
				isTreatDistinctAsVirtualColumn
			});
		}

		// Token: 0x06001297 RID: 4759 RVA: 0x0031995B File Offset: 0x00317B5B
		public static AppendNewLineAfterAndBeforeReverseKeyWordProcessor appendNewLineAfterAndBeforeReverseKeyWordProcessor(GFmtOpt option, bool inNewLine, string startKeyword, string endKeyword)
		{
			return ProcessorFactory.create<AppendNewLineAfterAndBeforeReverseKeyWordProcessor>(typeof(AppendNewLineAfterAndBeforeReverseKeyWordProcessor), option, new object[]
			{
				inNewLine,
				startKeyword,
				endKeyword
			});
		}

		// Token: 0x06001298 RID: 4760 RVA: 0x00319984 File Offset: 0x00317B84
		public static JoinOnProcessor createJoinOnProcessor(GFmtOpt option, bool selectFromclauseJoinOnInNewline, bool alignJoinWithFromKeyword)
		{
			return ProcessorFactory.create<JoinOnProcessor>(typeof(JoinOnProcessor), option, new object[]
			{
				selectFromclauseJoinOnInNewline,
				alignJoinWithFromKeyword
			});
		}

		// Token: 0x06001299 RID: 4761 RVA: 0x003199AE File Offset: 0x00317BAE
		public static UnionProcessor createUnionProcessor(GFmtOpt option)
		{
            //return ProcessorFactory.create<UnionProcessor>(typeof(UnionProcessor), option, Array.Empty<object>());
            return ProcessorFactory.create<UnionProcessor>(typeof(UnionProcessor), option, new object[0]);
        }

		// Token: 0x0600129A RID: 4762 RVA: 0x003199C5 File Offset: 0x00317BC5
		public static ExpressionProcessor createExpressionProcessor(GFmtOpt option)
		{
			return ProcessorFactory.createExpressionProcessor(option, new bool?(false));
		}

		// Token: 0x0600129B RID: 4763 RVA: 0x003199D3 File Offset: 0x00317BD3
		public static ExpressionProcessor createExpressionProcessor(GFmtOpt option, bool? isAndUnderWhere)
		{
			return ProcessorFactory.create<ExpressionProcessor>(typeof(ExpressionProcessor), option, new object[]
			{
				isAndUnderWhere
			});
		}

		// Token: 0x0600129C RID: 4764 RVA: 0x003199F4 File Offset: 0x00317BF4
		public static CaseWhenProcessor createCaseWhenProcessor(GFmtOpt option, bool? caseWhenThenInSameLine, int? indentCaseFromSwitch)
		{
			return ProcessorFactory.create<CaseWhenProcessor>(typeof(CaseWhenProcessor), option, new object[]
			{
				caseWhenThenInSameLine,
				indentCaseFromSwitch
			});
		}

		// Token: 0x0600129D RID: 4765 RVA: 0x00319A1E File Offset: 0x00317C1E
		public static SelectKeyWordAlignProcessor createSelectKeyWordAlignProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<SelectKeyWordAlignProcessor>(typeof(SelectKeyWordAlignProcessor), option, new object[0]);
		}

		// Token: 0x0600129E RID: 4766 RVA: 0x00319A35 File Offset: 0x00317C35
		public static MergeKeyWordAlignProcessor createMergeKeyWordAlignProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<MergeKeyWordAlignProcessor>(typeof(MergeKeyWordAlignProcessor), option, new object[0]);
		}

		// Token: 0x0600129F RID: 4767 RVA: 0x00319A4C File Offset: 0x00317C4C
		public static InsertKeyWordAlignProcessor createInsertKeyWordAlignProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<InsertKeyWordAlignProcessor>(typeof(InsertKeyWordAlignProcessor), option, new object[0]);
		}

		// Token: 0x060012A0 RID: 4768 RVA: 0x00319A63 File Offset: 0x00317C63
		public static AppendLineAfterInsertTableNameProcessor createAppendLineAfterInsertTableNameProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<AppendLineAfterInsertTableNameProcessor>(typeof(AppendLineAfterInsertTableNameProcessor), option, new object[0]);
		}

		// Token: 0x060012A1 RID: 4769 RVA: 0x00319A7A File Offset: 0x00317C7A
		public static AppendLineAfterMergeTableNameProcessor createAppendLineAfterMergeTableNameProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<AppendLineAfterMergeTableNameProcessor>(typeof(AppendLineAfterMergeTableNameProcessor), option, new object[0]);
		}

		// Token: 0x060012A2 RID: 4770 RVA: 0x00319A91 File Offset: 0x00317C91
		public static MergeWhenClauseProcessor createMergeWhenClauseProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<MergeWhenClauseProcessor>(typeof(MergeWhenClauseProcessor), option, new object[0]);
		}

		// Token: 0x060012A3 RID: 4771 RVA: 0x00319AA8 File Offset: 0x00317CA8
		public static CapitalisationProcessor createCapitalisationProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<CapitalisationProcessor>(typeof(CapitalisationProcessor), option, new object[0]);
		}

		// Token: 0x060012A4 RID: 4772 RVA: 0x00319ABF File Offset: 0x00317CBF
		public static AppendNewLineBeforeReverseKeyWordProcessor createAppendNewLineBeforeReverseKeyWordProcessor(GFmtOpt option, bool inNewLine, string keyword)
		{
			return ProcessorFactory.create<AppendNewLineBeforeReverseKeyWordProcessor>(typeof(AppendNewLineBeforeReverseKeyWordProcessor), option, new object[]
			{
				inNewLine,
				keyword
			});
		}

		// Token: 0x060012A5 RID: 4773 RVA: 0x00319AE4 File Offset: 0x00317CE4
		public static InsertValuesParenthsesAdjustProcessor createInsertValuesParenthsesAdjustProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<InsertValuesParenthsesAdjustProcessor>(typeof(InsertValuesParenthsesAdjustProcessor), option, new object[0]);
		}

		// Token: 0x060012A6 RID: 4774 RVA: 0x00319AFB File Offset: 0x00317CFB
		public static DeleteKeyWordAlignProcessor createDeleteKeyWordAlignProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<DeleteKeyWordAlignProcessor>(typeof(DeleteKeyWordAlignProcessor), option, new object[0]);
		}

		// Token: 0x060012A7 RID: 4775 RVA: 0x00319B12 File Offset: 0x00317D12
		public static UpdateKeyWordAlignProcessor createUpdateKeyWordAlignProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<UpdateKeyWordAlignProcessor>(typeof(UpdateKeyWordAlignProcessor), option, new object[0]);
		}

		// Token: 0x060012A8 RID: 4776 RVA: 0x00319B29 File Offset: 0x00317D29
		public static CreateTableBEInNewLineProcessor createCreateTableBEInNewLineProcessor(GFmtOpt option, bool? leftBEOnNewline, bool? rightBeOnNewline, bool? itemListInNewLine)
		{
			return ProcessorFactory.create<CreateTableBEInNewLineProcessor>(typeof(CreateTableBEInNewLineProcessor), option, new object[]
			{
				leftBEOnNewline,
				rightBeOnNewline,
				itemListInNewLine
			});
		}

		// Token: 0x060012A9 RID: 4777 RVA: 0x00319B5C File Offset: 0x00317D5C
		public static CreateTableItemAlignProcessor createCreateTableItemAlignProcessor(GFmtOpt option, TAlignOption alignOption)
		{
			return ProcessorFactory.create<CreateTableItemAlignProcessor>(typeof(CreateTableItemAlignProcessor), option, new object[]
			{
				alignOption
			});
		}

		// Token: 0x060012AA RID: 4778 RVA: 0x00319B7D File Offset: 0x00317D7D
		public static CTEProcessor createCTEProcessor(GFmtOpt option, bool? cteNewlineBeforeAs)
		{
			return ProcessorFactory.create<CTEProcessor>(typeof(CTEProcessor), option, new object[]
			{
				cteNewlineBeforeAs
			});
		}

		// Token: 0x060012AB RID: 4779 RVA: 0x00319B9E File Offset: 0x00317D9E
		public static DeclareVarItemAlignProcessor createDeclareVarItemAlignProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<DeclareVarItemAlignProcessor>(typeof(DeclareVarItemAlignProcessor), option, new object[0]);
		}

		// Token: 0x060012AC RID: 4780 RVA: 0x00319BB5 File Offset: 0x00317DB5
		public static CreateTableConstraintAlignProcessor createCreateTableConstraintAlignProcessor(GFmtOpt option)
		{
			return ProcessorFactory.create<CreateTableConstraintAlignProcessor>(typeof(CreateTableConstraintAlignProcessor), option, new object[0]);
		}

		// Token: 0x060012AD RID: 4781 RVA: 0x00319BCC File Offset: 0x00317DCC
		public static CombineWhitespaceAndClearReturnProcessor createCombineWhitespaceAndClearReturnProcessor(GFmtOpt opt)
		{
			return ProcessorFactory.create<CombineWhitespaceAndClearReturnProcessor>(typeof(CombineWhitespaceAndClearReturnProcessor), opt, new object[0]);
		}

		// Token: 0x060012AE RID: 4782 RVA: 0x00319BE3 File Offset: 0x00317DE3
		public static InsertOutputClauseProcessor createInsertOutputClauseProcessor(GFmtOpt opt)
		{
			return ProcessorFactory.create<InsertOutputClauseProcessor>(typeof(InsertOutputClauseProcessor), opt, new object[0]);
		}

		// Token: 0x060012AF RID: 4783 RVA: 0x00319BFA File Offset: 0x00317DFA
		public static ExecParaNewLineProcessor createExecParaNewLineProcessor(GFmtOpt opt, bool? linebreakBeforeParamInExec)
		{
			return ProcessorFactory.create<ExecParaNewLineProcessor>(typeof(ExecParaNewLineProcessor), opt, new object[]
			{
				linebreakBeforeParamInExec
			});
		}

		// Token: 0x060012B0 RID: 4784 RVA: 0x00319C1B File Offset: 0x00317E1B
		public static CreateFuncLeftBEProcessor createCreateFuncLeftBEProcessor(GFmtOpt opt, bool? beStyleFunctionLeftBEOnNewline, int? beStyleFunctionLeftBEIndentSize)
		{
			return ProcessorFactory.create<CreateFuncLeftBEProcessor>(typeof(CreateFuncLeftBEProcessor), opt, new object[]
			{
				beStyleFunctionLeftBEOnNewline,
				beStyleFunctionLeftBEIndentSize
			});
		}

		// Token: 0x060012B1 RID: 4785 RVA: 0x00319C45 File Offset: 0x00317E45
		public static CreateFuncRightBEProcessor createCreateFuncRightBEProcessor(GFmtOpt opt, bool? beStyleFunctionRightBEOnNewline, int? beStyleFunctionRightBEIndentSize)
		{
			return ProcessorFactory.create<CreateFuncRightBEProcessor>(typeof(CreateFuncRightBEProcessor), opt, new object[]
			{
				beStyleFunctionRightBEOnNewline,
				beStyleFunctionRightBEIndentSize
			});
		}

		// Token: 0x060012B2 RID: 4786 RVA: 0x00319C6F File Offset: 0x00317E6F
		public static CreateFuncFirstParamInNewlineProcessor createCreateFuncFirstParamInNewlineProcessor(GFmtOpt opt, bool? beStyleFunctionFirstParamInNewline)
		{
			return ProcessorFactory.create<CreateFuncFirstParamInNewlineProcessor>(typeof(CreateFuncFirstParamInNewlineProcessor), opt, new object[]
			{
				beStyleFunctionFirstParamInNewline
			});
		}

		// Token: 0x060012B3 RID: 4787 RVA: 0x00319C90 File Offset: 0x00317E90
		public static CreateFuncReturnsTableProcessor createCreateFuncReturnsTableProcessor(GFmtOpt opt)
		{
			return ProcessorFactory.create<CreateFuncReturnsTableProcessor>(typeof(CreateFuncReturnsTableProcessor), opt, new object[0]);
		}

		// Token: 0x060012B4 RID: 4788 RVA: 0x00319CA7 File Offset: 0x00317EA7
		public static CreateFuncWSPaddingParenthesesProcessor createCreateFuncWSPaddingParenthesesProcessor(GFmtOpt opt)
		{
			return ProcessorFactory.create<CreateFuncWSPaddingParenthesesProcessor>(typeof(CreateFuncWSPaddingParenthesesProcessor), opt, new object[0]);
		}

		// Token: 0x060012B5 RID: 4789 RVA: 0x00319CBE File Offset: 0x00317EBE
		public static IfStmtBEProcessor createIfStmtBEProcessor(GFmtOpt opt)
		{
			return ProcessorFactory.create<IfStmtBEProcessor>(typeof(IfStmtBEProcessor), opt, new object[0]);
		}

		// Token: 0x060012B6 RID: 4790 RVA: 0x00319CD5 File Offset: 0x00317ED5
		public static ReturnStmtProcessor createReturnStmtProcessor(GFmtOpt opt)
		{
			return ProcessorFactory.create<ReturnStmtProcessor>(typeof(ReturnStmtProcessor), opt, new object[0]);
		}

		// Token: 0x060012B7 RID: 4791 RVA: 0x00319CEC File Offset: 0x00317EEC
		public static CreateViewReturnProcessor createCreateViewReturnProcessor(GFmtOpt opt)
		{
			return ProcessorFactory.create<CreateViewReturnProcessor>(typeof(CreateViewReturnProcessor), opt, new object[0]);
		}

		// Token: 0x060012B8 RID: 4792 RVA: 0x00319D03 File Offset: 0x00317F03
		public static AlterTableOptionItemAlignProcessor createAlterTableOptionAlignProcessor(GFmtOpt option, bool inNewLine)
		{
			return ProcessorFactory.create<AlterTableOptionItemAlignProcessor>(typeof(AlterTableOptionItemAlignProcessor), option, new object[]
			{
				inNewLine
			});
		}

		// Token: 0x060012B9 RID: 4793 RVA: 0x00319D24 File Offset: 0x00317F24
		public static AppendNewLineBeforeKeyWordProcessor createAppendNewLineBeforeKeyWordProcessor(GFmtOpt option, bool inNewLine, string keyword, bool completely)
		{
			return ProcessorFactory.create<AppendNewLineBeforeKeyWordProcessor>(typeof(AppendNewLineBeforeKeyWordProcessor), option, new object[]
			{
				inNewLine,
				keyword,
				completely
			});
		}

		// Token: 0x060012BA RID: 4794 RVA: 0x00319D54 File Offset: 0x00317F54
		public static E create<E>(Type type, GFmtOpt option, params object[] parameters) where E : AbstractProcessor
		{
			if (!type.IsSubclassOf(typeof(AbstractProcessor)))
			{
				return default(E);
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(option.sessionId).Append(":");
			stringBuilder.Append(type.FullName).Append(":");
			if (parameters != null)
			{
				foreach (object obj in parameters)
				{
					stringBuilder.Append((obj != null) ? obj.ToString() : ":");
				}
			}
			if (!ProcessorFactory.processors.ContainsKey(stringBuilder.ToString()))
			{
				Type typeFromHandle = typeof(ProcessorFactory);
				lock (typeFromHandle)
				{
					if (!ProcessorFactory.processors.ContainsKey(stringBuilder.ToString()))
					{
						E e = ProcessorFactory.newInstance<E>(type);
						e.init(option, parameters);
						ProcessorFactory.processors[stringBuilder.ToString()] = e;
					}
				}
			}
			return (E)((object)ProcessorFactory.processors[stringBuilder.ToString()]);
		}

		// Token: 0x060012BB RID: 4795 RVA: 0x00319E88 File Offset: 0x00318088
		public static E newInstance<E>(Type type) where E : AbstractProcessor
		{
			return (E)((object)type.GetConstructor(Type.EmptyTypes).Invoke(null));
		}

		// Token: 0x060012BC RID: 4796 RVA: 0x00319EA0 File Offset: 0x003180A0
		public static void clear(string sessionId)
		{
			object obj = ProcessorFactory.@object;
			lock (obj)
			{
				IList<string> list = new List<string>();
				foreach (string text in ProcessorFactory.processors.Keys)
				{
					if (text.StartsWith(sessionId, StringComparison.Ordinal))
					{
						list.Add(text);
					}
				}
				foreach (string key in list)
				{
					ProcessorFactory.processors.Remove(key);
				}
			}
		}

		// Token: 0x060012BD RID: 4797 RVA: 0x00319F6C File Offset: 0x0031816C
		public static StmtListProcessor createStmtListProcessor(GFmtOpt opt, string alignKeyword)
		{
			return ProcessorFactory.create<StmtListProcessor>(typeof(StmtListProcessor), opt, new object[]
			{
				alignKeyword
			});
		}

		// Token: 0x060012BE RID: 4798 RVA: 0x00319F88 File Offset: 0x00318188
		public static BeginAndEndProcessor createBeginAndEndProcessor(GFmtOpt opt)
		{
			return ProcessorFactory.create<BeginAndEndProcessor>(typeof(BeginAndEndProcessor), opt, new object[0]);
		}

		// Token: 0x060012BF RID: 4799 RVA: 0x00319F9F File Offset: 0x0031819F
		public static PlsqlIfStmtBEProcessor createPlsqlIfStmtBEProcessor(GFmtOpt opt)
		{
			return ProcessorFactory.create<PlsqlIfStmtBEProcessor>(typeof(PlsqlIfStmtBEProcessor), opt, new object[0]);
		}

		// Token: 0x040013F4 RID: 5108
		private static volatile IDictionary<string, AbstractProcessor> processors = new ConcurrentDictionary<string, AbstractProcessor>();

		// Token: 0x040013F5 RID: 5109
		private static object @object = new object();
	}
}
